import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {TranslateLoader, TranslateModule} from '@ngx-translate/core';
import {HttpLoaderFactory} from '../app.module';
import {HttpClient} from '@angular/common/http';
import {NgZorroAntdModule} from 'ng-zorro-antd';

import {HomeComponent} from './home/home.component';
import {AboutComponent} from './about/about.component';
import {ContactComponent} from './contact/contact.component';
import {AffiliateComponent} from './affiliate/affiliate.component';
import {IndexComponent} from './index.component';
import {DescribeComponent} from './describe/describe.component';

@NgModule({
  imports: [
    CommonModule,
    TranslateModule.forChild({
      loader: {
        provide: TranslateLoader,
        useFactory: HttpLoaderFactory,
        deps: [HttpClient]
      }
    }),
    RouterModule.forChild([{
      path: '', component: IndexComponent,
      children: [
        {path: '', redirectTo: 'home', pathMatch: 'full'},
        {path: 'home', component: HomeComponent},
        {path: 'about', component: AboutComponent},
        {path: 'aff', component: AffiliateComponent},
        {path: 'contact', component: ContactComponent},
        {path: 'desc', component: DescribeComponent},
        {path: '**', redirectTo: 'home'}
      ]
    }]),
    NgZorroAntdModule
  ],
  declarations: [
    IndexComponent,
    HomeComponent,
    AboutComponent,
    ContactComponent,
    AffiliateComponent,
    DescribeComponent
  ]
})
export class IndexModule {
}
